package rtcf.framework
{
	import flash.net.NetConnection;
	import flash.net.NetStream;
	import flash.net.NetStreamPlayOptions;
	
	public class RTCFStream extends NetStream
	{
		
		private var component:RTCFComponent;
		
		public function RTCFStream(componentReference:RTCFComponent, connection:NetConnection, peerID:String="connectToFMS")
		{
			super(connection, peerID);
			component = componentReference;
		}
		
		override public function publish(name:String=null, type:String=null):void{
			if (typeof name == "string" && name.length > 0){
				super.publish(component._fullResourcePath_ + name, type);
			}
			else {
				super.publish(name, type);
			}
			
		}
		
		override public function play(...parameters):void{
			var path:Object = parameters[0];
			if (typeof path == "string" && path.length > 0){
				path = component._fullResourcePath_ + path;
				parameters[0] = path;
			}
			super.play.apply(super, parameters);
		}
		/*
		override public function play2(param:NetStreamPlayOptions):void{
			super.play2(param);
		}
		*/
		
	}
}